package com.zjj.algorithm.learning.niuke;

import java.util.Scanner;

/**
 * @author zjj_admin
 * @date 2023/2/8 21:17
 */
public class Test17 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        int x = 0, y = 0;
        String[] split = s.split(";");
        for (String str : split) {
            if (str.length() > 0 && isNumber(str.substring(1))) {
                int num = Integer.parseInt(str.substring(1));
                if (str.startsWith("A")) {
                    x -= num;
                } else if (str.startsWith("S")) {
                    y -= num;
                } else if (str.startsWith("W")) {
                    y += num;
                } else if (str.startsWith("D")) {
                    x += num;
                }
            }

        }
        System.out.println(x + "," + y);
    }

    public static boolean isNumber(String str) {
        int len = str.length();
        if (len < 1) {
            return false;
        }
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) < '0' || str.charAt(i) > '9') {
                return false;
            }
        }
        return true;
    }


}
